
import requests
from lxml import etree

url = 'https://maoyan.com/'


headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36'
}

res = requests.get(url=url,headers=headers)

tree = etree.HTML(res.text)


title_list = tree.xpath('//div[@class="panel-content"]//div[@class="movie-title"]/text()')
title_list1 = tree.xpath('//div[@class="panel-content"]//div[@class="movie-title movie-title-padding"]/text()')
link_list = tree.xpath('//div[@class="panel-content"]//div[@class="movie-poster"]/img[2]/@data-src')
score_list = tree.xpath('//div[@class="panel-content"]//div[@class="movie-score"]/i[1]/text()')
score_list2 = tree.xpath('//div[@class="panel-content"]//div[@class="movie-score"]/i[2]/text()')
# a = ''.join(score_list)

item = map(lambda x,y:x+y, score_list,score_list2)
a_list = [i for i in item]


for title in title_list+title_list1:
    print(title)

# print(title_list+title_list1)
# print(link_list)
# print(a_list)